#include <iostream>
#include<string>
using namespace std;
int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool IsLeapYear(int year)
{
    if((year%4==0&&year%100!=0)||(year%400==0))
        return true;
    return false;
}
struct Date
{
  int year;
  int month;
  int day;
  Date(int y,int m,int d)
    :year(y)
    ,month(m)
    ,day(d)
  {}

  void operator++()//前置++
  {
    day++;
    if(month==2)
    {
        if(IsLeapYear(year))//如果是闰年
        {
            if(day>days[year]+1)
            {
                day=1;
                month++;
            }
        }
        else
        {
            if(day>days[year])
            {
                day=1;
                month++;
            }
        }
    }
    else
    {
        if(day>days[year])
        {
            day=1;
            month++;
        }
    }
    if(month>12)
    {
        year++;
        month=1;
    }
  }
};

bool check(Date date)//检查是否含有1
{
    string s=to_string(date.year);
    s+=to_string(date.month);
    s+=to_string(date.day);
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='1')
            return true;
    }
    return false;
}

int main()
{
  Date date(2023,1,1);
  int ans=0;
  while(date.year!=2024)
  {
    if(check(date))
        ans+=5;
    else
        ans+=1;
    ++date;
  }
  cout<<ans<<endl;
  return 0;
}